<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<script type="text/javascript">
    function actualizaPromedio(f,pe,pd){
        if(pe==-1){
            tamano= pd.length;
            if(pd==""){
                pd=0;
            }
            if(pe==""){
                pe=0;
            }
            pd=parseInt(pd);
            pe=parseInt(pe);
            if(tamano>1){
                var prom = parseInt(f.promedio.value.valueOf());
                prom= prom + (pd/100);
            }else{
                var prom = parseInt(f.promedio.value.valueOf());
                prom= prom + (pd/10);
            }    
        }else if(pd==-1){
            if(pe==""){
                pe=0;
            }
            if(pd==""){
                pd=0;
            }
            tamano2=f.promedioParteDecimal.value.length
            pd=parseInt(pd);
            pe=parseInt(pe);
            if(f.promedioParteDecimal.value ==""){
                f.promedioParteDecimal.value=0;
            }
            if(tamano2>1){
                var prom=(f.promedioParteDecimal.value.valueOf()/100);
            }else{
                var prom=(f.promedioParteDecimal.value.valueOf()/10);
            }
            prom = prom + pe;
            
        }
        f.promedio.value =prom.valueOf();
    }
    
    function actualizaPromedioE(f,pe){
        actualizaPromedio(f,pe.value.valueOf(),-1);
    }
    
    function actualizaPromedioD(f,pd){
        actualizaPromedio(f,-1,pd.value.valueOf());
    }
    
    
    
</script>
<form>
<tr>
    <td>Promedio:</td>
    <td>
        <html:text maxlength="2" size="1" property="promedioParteEntera" onkeypress="return validar_texto(event)" /><strong>.</strong><html:text maxlength="2" size="1" property="promedioParteDecimal" onkeypress="return validar_texto(event)" /></td>
</tr>
</form>